using System;
using System.IO;
using Microsoft.WowAddonStudio.FrameXml.Components;
using Microsoft.WowAddonStudio.FrameXml.Design.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames;
using NUnit.Framework;

namespace Microsoft.WowAddonStudio.FrameXml.Design.Tests.XmlSerializerTest
{
	[TestFixture]
	public class ParentFrameInheritanceTest
	{
		private FrameXmlSerializer serializer;
		private const string TestXmlFileName = "test.xml";
		private Ui ui;

		#region SetUp

		[TestFixtureSetUp]
		public void TestFixtureSetUp()
		{
			serializer = new FileFrameXmlSerializer(TestXmlFileName);
		}

		[SetUp]
		public void SetUp()
		{
			if (File.Exists(TestXmlFileName)) File.Delete(TestXmlFileName);
			ui = new Ui();
		}

		#endregion

		#region TearDown

		[TearDown]
		public void TearDown()
		{
			if (File.Exists(TestXmlFileName)) File.Delete(TestXmlFileName);	
		}

		#endregion

		#region Tests

		[Test(Description = "")]
		public void Test_SerializeInheritedFrame()
		{
			var frame = new Frame
			            	{
			            		Inherits = "DialogBoxFrame", 
								Anchors = new[] {new Anchor {Point = new FramePoint()}}
							};
			var frameControl = new FrameControl(frame);
			ui.LayoutFrames.Add(frame);

			var uiControl = new UiControl(ui);
			
			//uiControl.Controls.Add(frameControl);

			serializer.Serialize(ui);

			Console.WriteLine(File.ReadAllText(TestXmlFileName));
		}


		#endregion
	}
}